#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <unistd.h>
#include <aio.h>
#include <string.h>
#include <errno.h>

// ./cp1 file1 file2 
int main(int argc, const char *argv[]){
        if(argc != 3) return -1;

	struct stat st; // 收集文件相关信息(大小、类型)
	int ret = stat(argv[1], &st);
	if(ret == 0){
	    printf("%s file type is %s, size is %ld\n",
			    argv[1], 
			    S_ISREG(st.st_mode)?"文件":"目录",
			    st.st_size);
	}

	return 0;
}
